<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MTB CAT1 Peripheral driver library: SysFault     (System Fault)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="IFXCYP_one-line.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MTB CAT1 Peripheral driver library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__group__sysfault.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#groups">API Reference</a>  </div>
  <div class="headertitle">
<div class="title">SysFault (System Fault)</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<p>The SysFault driver provides an API to configure the Fault reporting structure. </p>
<p>The functions and other declarations used in this driver are in cy_sysfault.h. You can include cy_pdl.h to get access to all functions and declarations in the PDL. This driver is only available for CAT1C, CAT1D devices.</p>
<p>The Fault subsystem contains information about faults that occur in the system. The fault subsystem captures only faults and it does not take any action to correct it. The subsystem can cause a reset, give a pulse indication, or trigger another peripheral. CAT1C, CAT1D uses a centralized fault report structure. The centralized nature allows for a system-wide consistent handling of faults, which simplifies software development as follows only a single fault interrupt handler is required. The fault report structure provides the fault source and additional fault-specific information from a single set of memory mapped input/output (MMIO) registers, no iterative search is required for the fault source and fault information. All pending faults are available from a single set of MMIO registers. Below is the block diagram. </p><div class="image">
<img src="fault.png" alt="fault.png"/>
</div>
<p>Fault IP provides fault report structure. Fault report structures capture faults. The number of fault report structures is specified by a design time configuration parameter (FAULT_NR). In CAT1C, CAT1D there are two instances of fault structures, each fault report structure has a dedicated set of MMIO control and status registers and captures a single fault. A fault report structure provides the fault source and additional fault specific information from a single set of MMIO registers. The fault structures capture faults like MPU/SMPU/PPI protection violations, peripheral specific errors, memory controller specific errors. E.g., SRAM controller ECC errors, FLASH controller read while program and ECC errors, Processor tightly coupled memory (TCM) ECC errors.</p>
<p>System fault will be captured by fault report structures. A fault report structure provides the fault source and additional fault specific information from a single set of MMIO registers. The captured fault information includes:</p><ul>
<li>A validity bit field that indicates a fault is captured.</li>
<li>A fault index that identifies the fault source.</li>
<li>Additional fault information describing fault specifics.</li>
</ul>
<h1><a class="anchor" id="group_sysfault_configuration"></a>
Configuration Considerations</h1>
<p>Fault configuration includes clearing the existing fault status, enabling fault source, setting interrupt mask, and fault initialization. Below is the code snippet for the fault configuration. </p><div class="fragment"><div class="line"></div><div class="line">    <span class="comment">/* Scenario: Configures the SysFault for recording faults. */</span></div><div class="line"></div><div class="line">    <span class="comment">/* Fault config */</span></div><div class="line">    <a class="code" href="structcy__stc___sys_fault__t.html">cy_stc_SysFault_t</a> config = </div><div class="line">    {</div><div class="line">        .ResetEnable   = <span class="keyword">false</span>,</div><div class="line">        .OutputEnable  = <span class="keyword">true</span>,</div><div class="line">        .TriggerEnable = <span class="keyword">false</span>,</div><div class="line">    };</div><div class="line"></div><div class="line">    <span class="comment">/* Configure Interrupt for Fault structure */</span></div><div class="line">    <a class="code" href="structcy__stc__sysint__t.html">cy_stc_sysint_t</a> IRQ_cfg =</div><div class="line">    {</div><div class="line">        .<a class="code" href="structcy__stc__sysint__t.html#a204a8f07adf056c8d3dd818136da853f">intrSrc</a> = ((NvicMux3_IRQn &lt;&lt; <a class="code" href="group__group__sysint.html#ga3b9f1b9de4f122495a8b6580ce500d9a">CY_SYSINT_INTRSRC_MUXIRQ_SHIFT</a>) | cpuss_interrupts_fault_0_IRQn), <span class="comment">/* Bit 0-15 of intrSrc is used to store system interrupt value and bit 16-31 to store CPU IRQ value */</span></div><div class="line">        .intrPriority = 2UL</div><div class="line">   };</div><div class="line"></div><div class="line">    <span class="comment">/*********************************************************************/</span></div><div class="line">    <span class="comment">/*****                 Fault report settings                     *****/</span></div><div class="line">    <span class="comment">/*********************************************************************/</span></div><div class="line">    <a class="code" href="group__group__sysfault__functions.html#ga0a2a097b9b1d69fb51806964639c7af7">Cy_SysFault_ClearStatus</a>(FAULT_STRUCT0); <span class="comment">// clear status</span></div><div class="line">    <a class="code" href="group__group__sysfault__functions.html#gafb1516898b15bdc985a7460c7a9f7ca1">Cy_SysFault_SetMaskByIdx</a>(FAULT_STRUCT0, CY_SYSFAULT_SRSS_MCWDT0); <span class="comment">// enable Fault MCWDT #0</span></div><div class="line">    <a class="code" href="group__group__sysfault__functions.html#ga2b7d86c125f4c1d55ffabfecc3b31338">Cy_SysFault_SetInterruptMask</a>(FAULT_STRUCT0);</div><div class="line">    <a class="code" href="group__group__sysfault__enums.html#gacc27f18e05d5cf7dbd13a6d27f0a2833">cy_en_SysFault_status_t</a> status = <a class="code" href="group__group__sysfault__functions.html#ga883297a5695f829251d11fb1cc6b6b4c">Cy_SysFault_Init</a>(FAULT_STRUCT0, &amp;config);</div><div class="line"></div><div class="line">    <span class="comment">/*********************************************************************/</span></div><div class="line">    <span class="comment">/*****                   Interrupt settings                      *****/</span></div><div class="line">    <span class="comment">/*********************************************************************/</span></div><div class="line">    <a class="code" href="group__group__sysint__functions.html#gab2ff6820a898e9af3f780000054eea5d">Cy_SysInt_Init</a>(&amp;IRQ_cfg, &amp;irqFaultHandler);</div><div class="line">    NVIC_SetPriority((<a class="code" href="group__group__sysint__enums.html#ga7e1129cd8a196f4284d41db3e82ad5c8">IRQn_Type</a>) NvicMux3_IRQn,  2UL);</div><div class="line">    NVIC_EnableIRQ((<a class="code" href="group__group__sysint__enums.html#ga7e1129cd8a196f4284d41db3e82ad5c8">IRQn_Type</a>) NvicMux3_IRQn);</div><div class="line"></div><div class="line">    <span class="comment">/* Triggers an interrupt via a software write.*/</span></div><div class="line">    <a class="code" href="group__group__sysfault__functions.html#gac41a1a4c626385118e6bbacba1b38866">Cy_SysFault_SetInterrupt</a>(FAULT_STRUCT0);</div><div class="line"></div></div><!-- fragment --><p> Once the configured fault occurs, the interrupt handler will be triggered where the fault information can be captured. Below is the code snippet that can be part of a interrupt handler. </p><div class="fragment"><div class="line"></div><div class="line">    <span class="comment">/* Scenario: Handle the faults generated and get the fault data. */</span></div><div class="line"></div><div class="line">    <span class="comment">/* Returns the status of the interrupt for the fault structure */</span></div><div class="line">    uint32_t intrSource = <a class="code" href="group__group__sysfault__functions.html#ga9d607437d17ab97572fb76b4eb77a186">Cy_SysFault_GetInterruptStatus</a>(FAULT_STRUCT0);</div><div class="line"></div><div class="line">    <span class="comment">/* Returns the interrupt mask. */</span></div><div class="line">    uint32_t intrMskStatus =<a class="code" href="group__group__sysfault__functions.html#ga873b3af5bd4bc10b844f9b4d781c37a9">Cy_SysFault_GetInterruptMask</a>(FAULT_STRUCT0);</div><div class="line"></div><div class="line">    <span class="comment">/* Returns whether masked interrupt  and triggered the interrupt are same. */</span></div><div class="line">    uint32_t intrMskdStatus = <a class="code" href="group__group__sysfault__functions.html#ga290a6f77497d8310d7f8efd55600225c">Cy_SysFault_GetInterruptStatusMasked</a>(FAULT_STRUCT0);</div><div class="line"></div><div class="line">    cy_en_SysFault_source_t status = <a class="code" href="group__group__sysfault__functions.html#ga709ec3b6d64ecd3ca0fc712715f66b7e">Cy_SysFault_GetErrorSource</a>(FAULT_STRUCT0);</div><div class="line"></div><div class="line">    <span class="keywordflow">if</span>(status != CY_SYSFAULT_NO_FAULT)</div><div class="line">    {</div><div class="line">        <span class="keywordflow">if</span>(status == CY_SYSFAULT_SRSS_MCWDT0) <span class="comment">// MCWDT0 fault</span></div><div class="line">        {</div><div class="line">             <a class="code" href="group__group__sysfault__functions.html#ga140278f2e209ee8dfb39eb1574850742">Cy_SysFault_GetFaultData</a>(FAULT_STRUCT0, <a class="code" href="group__group__sysfault__enums.html#gga9043fc01c3dfcd1fcad3fa52fcc931f4a1515b67cfe882332b0ed2071283e6a37">CY_SYSFAULT_DATA0</a>); <span class="comment">//Get fault data</span></div><div class="line">        }</div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="comment">/* Clears an interrupt mask.*/</span></div><div class="line">    <a class="code" href="group__group__sysfault__functions.html#ga9ea5e9f82d9a8fad319651386772ea1c">Cy_SysFault_ClearInterruptMask</a>(FAULT_STRUCT0);</div><div class="line"></div><div class="line">    <span class="comment">/* Clear Interrupt flag */</span></div><div class="line">    <a class="code" href="group__group__sysfault__functions.html#ga2c96322cea288ecd72616b6cf2d77c52">Cy_SysFault_ClearInterrupt</a>(FAULT_STRUCT0);</div><div class="line"></div></div><!-- fragment --> <h1><a class="anchor" id="group_sysfault_section_more_information"></a>
More Information</h1>
<p>For more information on the System Fault, refer to the technical reference manual (TRM).</p>
<h1><a class="anchor" id="group_sysfault_changelog"></a>
Changelog</h1>
<table class="doxtable">
<tr>
<th>Version</th><th>Changes</th><th>Reason for Change </th></tr>
<tr>
<td>1.30 </td><td>Added enum <a class="el" href="group__group__sysfault__enums.html#ga84e3782fd6b0f6e67b490974c02c945f">en_sysfault_source_t</a> and new macros. </td><td>Support added for CAT1D and enabled sysfault compilation for PSoC C3 (CAT1B).  </td></tr>
<tr>
<td>1.20 </td><td>Updated <a class="el" href="group__group__sysfault__functions.html#ga709ec3b6d64ecd3ca0fc712715f66b7e">Cy_SysFault_GetErrorSource</a> API and added new macro </td><td>MISRA 10.8 fix and code enhancement  </td></tr>
<tr>
<td>1.10 </td><td>Updated macro related to driver enablement for CAT1C without any functional impact </td><td>Code Enhancement  </td></tr>
<tr>
<td>1.0 </td><td>Initial version </td><td></td></tr>
</table>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="groups"></a>
API Reference</h2></td></tr>
<tr class="memitem:group__group__sysfault__macros"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysfault__macros.html">Macros</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__sysfault__enums"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysfault__enums.html">Enums</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__sysfault__data__structures"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysfault__data__structures.html">Data Structures</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__sysfault__functions"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysfault__functions.html">Functions</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>MTB CAT1 Peripheral driver library</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
